import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


public class LitTable {

	//store addr:literal values .
	private static Map<Integer,Integer> litTable = new HashMap<Integer,Integer>();
	//store literal values.
	private static List<Integer> lits = new ArrayList<Integer>();
	
	public static void stLit(int i) {
		lits.add(i);
	}
	
	public static void add(Integer addr,Integer lit){
		litTable.put(addr, lit);
	}
		
	public static void appendLit() {
		for(int i=0;i<lits.size();i++){
			int val = lits.get(i);
			litTable.put(val,Lines.getLC());
			Lines.setLC(1);
		}
	}
	
	public static int get(int key){
		return litTable.get(key);
	}
	
	public static int size() {
		return lits.size();
	}
	
	public static String toObj(int i) {
		
			return "T"+Utilities.intToHex(litTable.get(lits.get(i)))+Utilities.intToHex(lits.get(i));
		}
	

	public static String tolst(int i) {
		return "("+Utilities.intToHex(litTable.get(lits.get(i)))+") "+Utilities.intToHex(lits.get(i))
					+" "+Utilities.toBinary(lits.get(i),16)+" ( lit)";
	}
	}

